/**
 * 插入排序
 */
package com.study.s02.sort;

public class InsertSort {
	
	public static void sort(long[] array) {
		
		long tmp = 0;
		
		for (int i = 1; i < array.length; i++) {
			
			tmp = array[i];
			int j = i;
			while(j > 0 && array[j - 1] > tmp) {
				array[j] = array[j - 1];
				j--;
			}
			array[j] = tmp;
		}
	}
}
